<?php
    require_once('page_base_jectly.php');

	/*
     * sub classes of page_base_jectly will include only the changes from index_2;
	 */
	class user extends page_base_jectly {

        protected $contents_html='<div class=\'center\'>This is a user page.</div>';
        protected $id;//user_id
        public $user;//TableUserProject

        function __construct() {
            parent::__construct();
            $this->bool_main_menu_on=true;
            $this->bool_main_logo_on=true;
            $this->bool_search_tab_on=false;
            $this->bool_breadcrumb_on=false;
            $this->bool_main_3boxes_on=false;
            $this->bool_search_result_within_page_on=false;
            $this->bool_account_menu_on=false;
            $this->bool_contents_area_on=true;
        }

        protected function Form_Create() {

            //parent::Form_Create();

            $this->check_query_string();

            $this->panel_search_tab_Create();
            $this->panel_menubar_Create();

            if($this->bool_logined())
            {
                $this->pnl_mebubar->hide_all_controls();
            }

            if(isset($this->selected_category_index_string) && is_numeric($this->selected_category_index_string))
            {
                $this->set_index_listbox_search_project(intval($this->selected_category_index_string));
            }

            $this->load_user();
		}

        protected function check_query_string()
        {
            //check menubar mode
            $this->mode_string_page=QApplication::QueryString('p');

            if(!empty($this->mode_string_page))
            {
                if($this->mode_string_page ==='0')
                {
                    $this->bool_mode_login=true;
                    $this->bool_mode_register=false;
                    $this->bool_mode_forgot=false;
                }
                else if($this->mode_string_page ==='1')
                {
                    $this->bool_mode_login=false;
                    $this->bool_mode_register=true;
                    $this->bool_mode_forgot=false;
                }
                else if($this->mode_string_page ==='2')
                {
                    $this->bool_mode_login=false;
                    $this->bool_mode_register=false;
                    $this->bool_mode_forgot=true;
                }
            }
            else
            {
                $this->bool_mode_login=true;
                $this->bool_mode_register=false;
                $this->bool_mode_forgot=false;
            }

            $this->category_string=QApplication::QueryString('c');//category_id
            $this->selected_category_index_string=QApplication::QueryString('i');//category_list_index

            if(is_numeric(QApplication::QueryString('id')))
            {
                $this->id=QApplication::QueryString('id');//project_id
            }
        }

        protected function load_user()
        {
            if(isset($this->id) && is_numeric($this->id))
            {
                $this->user=TableUserProject::LoadById($this->id);

                if(isset($this->user))
                {
                    $this->contents_html='user loaded-'.$this->user->UserName;
                }
                else
                {
                    $this->contents_html='user not found id='.$this->id;
                    $this->id=null;
                }
            }
        }

        public function render_contents_area() {

            if($this->bool_contents_area_on)
            {
                echo($this->contents_html);
            }
        }

	}

    user::Run('user','user.tpl.php');

?>